package com.graduation.alien_yuan.smartmusicplayer;

import android.util.Log;

/**
 * Created by Alien_yuan on 2016/3/14.
 */
public class SinWave {
    public static final int HEIGHT = 127;
    public static final double TWOPI = 2 * Math.PI;
    /**
     * �������Ҳ�
     * @param wave
     * @param waveLen
     * @param length
     * @return
     */
    public static byte[] sin(int fhz,byte[] wave, int waveLen, int length) {

        for (int i = 0; i < length; i++) {
            int f=fhz;
            wave[i] = (byte) (HEIGHT * (1-Math.sin(TWOPI * f * i/44100)));
        }
        for (int i = 0; i < waveLen; i++){
            int a=wave[i];
            Log.d("sinvoice", "a="+a);
        }

        return wave;
    }
}

